﻿using IPR_StudyMeetingMrgSys.Enums;
using IPR_StudyMeetingMrgSys.Extension;
using IPR_StudyMeetingMrgSys.Models;
using IPR_StudyMeetingMrgSys.ViewModel;
using log4net;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Reflection;
using System.Web;
using System.Web.Http;
using System.IO;
using System.Security.Cryptography;

namespace IPR_StudyMeetingMrgSys.Controllers
{
    public class ProjectController : ApiController
    {
        ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        IPR_StudyMeetingMrgSys.BLL.T_Project bll = new BLL.T_Project();

        /// <summary>
        /// 获取所有的项点大类
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Route("api/Project/GetProClass")]
        public IHttpActionResult GetProClass()
        {
            ResultMsg resultMsg = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            try
            {
                bool blexist = false;
                string sSql = "  select distinct ProClass from T_Project ";
                DataSet dataSet = bll.GetQuery(sSql);
                if (dataSet != null)
                    if (dataSet.Tables.Count > 0)
                        if (dataSet.Tables[0].Rows.Count > 0)
                        {
                            resultMsg.Info = StatusCodeEnum.Success.GetEnumText();
                            resultMsg.Data = dataSet.Tables[0];
                            resultMsg.Count = dataSet.Tables[0].Rows.Count;
                            blexist = true;
                        }
                if (!blexist)
                {
                    resultMsg.Info = "未获取到相应数据";
                }
            }
            catch (Exception ex)
            {
                resultMsg.StatusCode = (int)StatusCodeEnum.Error;
                resultMsg.Info = StatusCodeEnum.Error.GetEnumText();
                resultMsg.Data = ex.Message;
                log.Error(ex);
            }
            return Json(resultMsg);
        }

        /// <summary>
        /// 根据项点大类获取所有的项点类型
        /// </summary>
        /// <param name="proclass"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("api/Project/GetProType")]
        public IHttpActionResult GetProType(string proclass)
        {
            ResultMsg resultMsg = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            try
            {
                bool blexist = false;
                string sSql = "  select distinct ProType from T_Project where ProClass like '%" + proclass + "%'";
                DataSet dataSet = bll.GetQuery(sSql);
                if (dataSet != null)
                    if (dataSet.Tables.Count > 0)
                        if (dataSet.Tables[0].Rows.Count > 0)
                        {
                            resultMsg.StatusCode =(int) StatusCodeEnum.Success;
                            resultMsg.Info = StatusCodeEnum.Success.GetEnumText();
                            resultMsg.Data = dataSet.Tables[0];
                            resultMsg.Count = dataSet.Tables[0].Rows.Count;
                            blexist = true;
                        }
                if (!blexist)
                {
                    resultMsg.Info = "未获取到相应数据";
                }
            }
            catch (Exception ex)
            {
                resultMsg.StatusCode = (int)StatusCodeEnum.Error;
                resultMsg.Info = StatusCodeEnum.Error.GetEnumText();
                resultMsg.Data = ex.Message;
                log.Error(ex);
            }
            return Json(resultMsg);
        }

        /// <summary>
        /// 根据项点大类和项点类型获取所有的项点
        /// </summary>
        /// <param name="proclass"></param>
        /// <param name="protype"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("api/Project/GetProInfo")]
        public IHttpActionResult GetProInfo(string proclass, string protype)
        {
            ResultMsg resultMsg = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            try
            {
                bool blexist = false;
                string sSql = "   select * from T_Project where  ProClass='" + proclass + "' and ProType='" + protype + "' ";
                DataSet dataSet = bll.GetQuery(sSql);
                if (dataSet != null)
                    if (dataSet.Tables.Count > 0)
                        if (dataSet.Tables[0].Rows.Count > 0)
                        {
                            resultMsg.Info = StatusCodeEnum.Success.GetEnumText();
                            resultMsg.Data = dataSet.Tables[0];
                            resultMsg.Count = dataSet.Tables[0].Rows.Count;
                            blexist = true;
                        }
                if (!blexist)
                {
                    resultMsg.Info = "未获取到相应数据";
                }
            }
            catch (Exception ex)
            {
                resultMsg.StatusCode = (int)StatusCodeEnum.Error;
                resultMsg.Info = StatusCodeEnum.Error.GetEnumText();
                resultMsg.Data = ex.Message;
                log.Error(ex);
            }
            return Json(resultMsg);
        }


        /// <summary>
        /// 根据老师ID获取该监考老师监考的所有的项点信息
        /// </summary>
        /// <param name="teacherid"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("api/Project/GetProInfoForTeacherID")]
        public IHttpActionResult GetProInfoForTeacherID(string teacherid)
        {
            ResultMsg resultMsg = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            try
            {
                bool blexist = false;
                string sSql = " select T1.*,T2.FID AS TrainID from T_Project T1 left join T_TrainInfo T2 on T1.ProNo=T2.ProNo  where TeacherID = '" + teacherid + "' and EndDateTime<CONVERT(varchar(20),GETDATE(),120) and T1.IsDelete = 0 ";
                DataSet dataSet = bll.GetQuery(sSql);
                if (dataSet != null)
                    if (dataSet.Tables.Count > 0)
                        if (dataSet.Tables[0].Rows.Count > 0)
                        {
                            resultMsg.Info = StatusCodeEnum.Success.GetEnumText();
                            resultMsg.Data = dataSet.Tables[0];
                            resultMsg.Count = dataSet.Tables[0].Rows.Count;
                            blexist = true;
                        }
                if (!blexist)
                {
                    resultMsg.Info = "未获取到相应数据";
                }
            }
            catch (Exception ex)
            {
                resultMsg.StatusCode = (int)StatusCodeEnum.Error;
                resultMsg.Info = StatusCodeEnum.Error.GetEnumText();
                resultMsg.Data = ex.Message;
                log.Error(ex);
            }
            return Json(resultMsg);
        }

        /// <summary>
        /// 根据项点ID、项点名称、项点大类、项点类型查询所有的项点信息 
        /// </summary>
        /// <param name="prono">项点编号</param>
        /// <param name="proname">项点名称</param>
        /// <param name="proclass">项点大类</param>
        /// <param name="protype">项点类型</param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/Project/SearchProjectInfo")]
        public IHttpActionResult SearchProjectInfo(VM_Project vmPro)
        {
            ResultMsg resultMsg = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            try
            {
                bool blexist = false;
                string sSql = "   select * from T_Project where IsDelete=0 ";
                //if (!String.IsNullOrEmpty(vmPro.ProNo==null?vmPro.ProNo:"0"))
                //    sSql += " and ProNo=" + vmPro.ProNo;
                if (!String.IsNullOrEmpty(vmPro.ProName))
                    sSql += " and ProName like '%" + vmPro.ProName == null ? "" : vmPro.ProName + "%'";
                if (!String.IsNullOrEmpty(vmPro.ProClass))
                    sSql += " and ProClass='" + vmPro.ProClass + "'";
                if (!String.IsNullOrEmpty(vmPro.ProType))
                    sSql += " and ProType='" + vmPro.ProType + "'";

                DataSet dataSet = bll.GetQuery(sSql);
                if (dataSet != null)
                    if (dataSet.Tables.Count > 0)
                        if (dataSet.Tables[0].Rows.Count > 0)
                        {
                            resultMsg.Info = StatusCodeEnum.Success.GetEnumText();
                            resultMsg.Data = dataSet.Tables[0];
                            resultMsg.Count = dataSet.Tables[0].Rows.Count;
                            blexist = true;
                        }
                if (!blexist)
                {
                    resultMsg.Info = "未获取到相应数据";
                }
            }
            catch (Exception ex)
            {
                resultMsg.StatusCode = (int)StatusCodeEnum.Error;
                resultMsg.Info = StatusCodeEnum.Error.GetEnumText();
                resultMsg.Data = ex.Message;
                log.Error(ex);
            }
            return Json(resultMsg);
        }



        /// <summary>
        /// 根据项点ID、项点名称、项点大类、项点类型查询所有的项点信息 
        /// </summary>
        /// <param name="prono">项点编号</param>
        /// <param name="proname">项点名称</param>
        /// <param name="proclass">项点大类</param>
        /// <param name="protype">项点类型</param>
        /// <returns></returns>
        [HttpGet]
        [Route("api/Project/GetAllProjecInfo")]
        public IHttpActionResult GetAllProjecInfo(string swhere, int page, int limit)
        {
            ResultMsg resultMsg = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            int RowCount = 0;
            try
            {
                int startindex = (page - 1) * limit + 1;
                int endindex = page * limit;
                if (!string.IsNullOrEmpty(swhere == null ? string.Empty : swhere.Trim()))
                {
                    Dictionary<string, string> jsonObject = JsonConvert.DeserializeObject<Dictionary<string, string>>(swhere);
                    swhere = string.Empty;
                    swhere = " IsDelete=0 and 1=1 ";
                    foreach (var item in jsonObject)
                    {
                        if (item.Key == "ProName")
                        {
                            if (!String.IsNullOrEmpty(item.Value))
                                swhere += $" and ProName like '%{item.Value}%'";
                        }
                        if (item.Key == "ProClass")
                        {
                            if (!String.IsNullOrEmpty(item.Value))
                                swhere += $" and ProClass = '{item.Value}'";
                        }
                        if (item.Key == "ProType")
                        {
                            if (!String.IsNullOrEmpty(item.Value))
                                swhere += $" and ProType = '{item.Value}'";
                        }
                    }
                }

                bool blexist = false;
                DataSet dataSet = bll.GetListByPage(swhere, "ProNo", startindex, endindex, out RowCount);
                if (dataSet != null)
                    if (dataSet.Tables.Count > 0)
                        if (dataSet.Tables[0].Rows.Count > 0)
                        {
                            resultMsg.Info = StatusCodeEnum.Success.GetEnumText();
                            resultMsg.Data = dataSet.Tables[0];
                            resultMsg.Count = RowCount;
                            blexist = true;
                        }
                if (!blexist)
                {
                    resultMsg.Info = "未获取到相应数据";
                }
            }
            catch (Exception ex)
            {
                resultMsg.StatusCode = (int)StatusCodeEnum.Error;
                resultMsg.Info = StatusCodeEnum.Error.GetEnumText();
                resultMsg.Data = ex.Message;
                resultMsg.Count = RowCount;
                log.Error(ex);
            }
            return Json(resultMsg);
        }





        /// <summary>
        /// 项点信息删除(根据项点ID)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("api/Project/Del")]
        public IHttpActionResult Del(string fid)
        {
            log.Info(JsonConvert.SerializeObject(" delete " + fid));

            ResultMsg resultMsg = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            try
            {
                if (new IPR_StudyMeetingMrgSys.BLL.T_Project().Delete(Convert.ToInt32(fid)))
                {
                    resultMsg.Info = "删除成功";
                    resultMsg.Count = 1;
                }
                else
                {
                    resultMsg.Info = "删除失败";
                }
            }
            catch (Exception ex)
            {
                resultMsg.StatusCode = (int)StatusCodeEnum.Error;
                resultMsg.Info = StatusCodeEnum.Error.GetEnumText();
                resultMsg.Data = ex.Message;
                log.Error(ex);
            }
            return Json(resultMsg);
        }


        /// <summary>
        /// 人员信息删除(根据人员工号)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("api/Project/DelList")]
        public IHttpActionResult DelList(string delidlist)
        {
            log.Info(JsonConvert.SerializeObject(delidlist));

            ResultMsg resultMsg = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            try
            {
                if (new IPR_StudyMeetingMrgSys.BLL.T_Project().DeleteList(delidlist))
                {
                    resultMsg.Info = "删除成功";
                    resultMsg.Count = 1;
                }
                else
                {
                    resultMsg.Info = "删除失败";
                }
            }
            catch (Exception ex)
            {
                resultMsg.StatusCode = (int)StatusCodeEnum.Error;
                resultMsg.Info = StatusCodeEnum.Error.GetEnumText();
                resultMsg.Data = ex.Message;
                log.Error(ex);
            }
            return Json(resultMsg);
        }
        [HttpPost]
        [Route("api/Project/FileUpload")]
        public IHttpActionResult FileUpload()
        {
            log.Info("开始文件上传，文件数：" + HttpContext.Current.Request.Files.Count.ToString());
            Res res = new Res();
            var ProName = HttpContext.Current.Request["ProName"].ToString();
            var ProDescribe = HttpContext.Current.Request["ProDescribe"].ToString();
            var ProClass = HttpContext.Current.Request["ProClass"].ToString();
            var ProType = HttpContext.Current.Request["ProType"].ToString();
            var ProValue = HttpContext.Current.Request["ProValue"].ToString();
            var ProVersion = HttpContext.Current.Request["ProVersion"].ToString();
            var FileType = HttpContext.Current.Request["FileType"].ToString();

            var file = HttpContext.Current.Request.Files.Count > 0 ? HttpContext.Current.Request.Files[0] : null;

            log.Info("开始文件上传");
            var path = "";
            var fileName = "";
            if (file != null && file.ContentLength > 0)
            {
                fileName = Path.GetFileName(file.FileName);
                if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/uploads")))
                {
                    Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/uploads"));
                }
                string secondFilePath = "";
                string svrFilePathPlusName = "";
                if (FileType == "1")
                {
                    secondFilePath = Path.Combine(
                    HttpContext.Current.Server.MapPath("~/uploads"),
                    "videoexam"
                    );
                    svrFilePathPlusName = "/uploads/videoexam/" + fileName;
                }
                else if (FileType == "2")
                {
                    secondFilePath = Path.Combine(
                    HttpContext.Current.Server.MapPath("~/uploads"),
                    "videostudy"
                    );
                    svrFilePathPlusName = "/uploads/videostudy/" + fileName;
                }
                else if(FileType=="3")
                {
                    secondFilePath = Path.Combine(
                    HttpContext.Current.Server.MapPath("~/uploads"),
                    "icourl"
                    );
                    svrFilePathPlusName = "/uploads/icourl/" + fileName;
                }
                if (!Directory.Exists(secondFilePath))
                {
                    Directory.CreateDirectory(secondFilePath);
                }
                 

                log.Info("开始文件上传:" + fileName);
                //file.SaveAs(path);
                #region 开始上传  

                //图片或者视频等其它文件直接存储
                path = Path.Combine(
           secondFilePath,
           fileName
       );
                file.SaveAs(path);
                #endregion
                #region 汇总数据字段
                try
                {
                    Model.T_Project mProject = new Model.T_Project();
                    string strSql = "";
                    if (FileType == "1")
                    {
                        strSql = " update T_Project set ProUrl='" + svrFilePathPlusName + "' where ProName='" + ProName + "' ";
                        mProject.ProUrl = svrFilePathPlusName;
                        mProject.ProStartUrl = "";
                        mProject.IcoUrl = "";
                    }
                    if (FileType == "2")
                    {
                        strSql = " update T_Project set ProStartUrl='" + svrFilePathPlusName + "' where ProName='" + ProName + "' ";
                        mProject.ProUrl = "";
                        mProject.ProStartUrl = svrFilePathPlusName;
                        mProject.IcoUrl = "";
                    }
                    if (FileType == "3")
                    {
                        strSql = " update T_Project set IcoUrl='" + svrFilePathPlusName + "' where ProName='" + ProName + "' ";
                        mProject.ProUrl = "";
                        mProject.ProStartUrl = "";
                        mProject.IcoUrl = svrFilePathPlusName;
                    }
                    if (new BLL.T_Project().Exists(ProName))
                    {
                        new BLL.SysManage().ExecuteSql(strSql);
                    }
                    else
                    {
                        mProject.ProNo = new BLL.T_Project().GetMaxId();
                        mProject.ProName = ProName;
                        mProject.ProDescribe = ProDescribe;
                        mProject.ProClass = ProClass;
                        mProject.ProType = ProType;
                        mProject.ProValue = string.IsNullOrEmpty(ProValue) ? 0 : Convert.ToInt32(ProValue);
                        mProject.ProVersion = ProVersion;
                        mProject.IsDelete = 0;
                        new BLL.T_Project().Add(mProject);
                    }

                    res.code = (int)StatusCodeEnum.Success;
                    res.msg = StatusCodeEnum.Success.GetEnumText();

                    res.data = new cdata();
                    res.data.src = svrFilePathPlusName;
                }
                catch (Exception exc)
                {
                    log.Info("数据库开始存储错误" + exc.Message);
                    res.code = (int)StatusCodeEnum.Error;
                    res.msg = exc.Message;
                    res.data = new cdata();
                    res.data.src = svrFilePathPlusName;
                }
                #endregion 
            }
            log.Info("文件数" + HttpContext.Current.Request.Files.Count.ToString() + "=" + fileName + "-" + path);
            return Json(res);
        }
        public string MD5Encrypt(string pToEncrypt, string sKey)
        {
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] fromData = System.Text.Encoding.Unicode.GetBytes(pToEncrypt);
            byte[] targetData = md5.ComputeHash(fromData);
            string byte2String = null;

            for (int i = 0; i < targetData.Length; i++)
            {
                byte2String += targetData[i].ToString("X");
            }

            return byte2String;
        }

        public class Res
        {
            /// <summary>
            /// 状态码
            /// </summary>
            public int code { get; set; }

            /// <summary>
            /// 操作信息
            /// </summary>
            public string msg { get; set; }

            private cdata mydata;
            /// <summary>
            /// 返回数据
            /// </summary>
            public cdata data
            {
                get { return mydata; }
                set { mydata = value; }
            }
        }
        public class cdata
        {
            /// <summary>
            /// 操作信息
            /// </summary>
            public string src { get; set; }
        }

        [HttpPost]
        [Route("api/Project/uploadPortrait")]
        public IHttpActionResult uploadPortrait(String s_rkbm, String type)
        {

            log.Info("开始文件上传，文件数：" + HttpContext.Current.Request.Files.Count.ToString());
            Res res = new Res();
            //var FTID = HttpContext.Current.Request["FTID"].ToString();
            //var KKID = HttpContext.Current.Request["KKID"].ToString();
            //var TFUploadDeptID = HttpContext.Current.Request["TFUploadDeptID"].ToString();
            //var TFFileLevel = HttpContext.Current.Request["TFFileLevel"].ToString();
            //var TFFileKey = HttpContext.Current.Request["TFFileKey"].ToString();
            //var TFReadTime = HttpContext.Current.Request["TFReadTime"].ToString() == "" ? "0" : HttpContext.Current.Request["TFReadTime"].ToString();

            var file = HttpContext.Current.Request.Files.Count > 0 ? HttpContext.Current.Request.Files[0] : null;

            log.Info("开始文件上传:341");
            var path = "";
            var fileName = "";
            if (file != null && file.ContentLength > 0)
            {
                fileName = Path.GetFileName(file.FileName);
                if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/uploads")))
                {
                    Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/uploads"));
                }
                path = Path.Combine(
                    HttpContext.Current.Server.MapPath("~/uploads"),
                    fileName
                );

                log.Info("开始文件上传:" + fileName);
                //file.SaveAs(path);
                #region 开始保存
                string sExt = System.IO.Path.GetExtension(fileName);
                string svrFilePathPlusName = "";
                string sFactPathPDF = "";
                if (sExt.ToUpper() == ".PDF")
                {
                    //如果是PDF文件直接存储
                    file.SaveAs(path);
                    svrFilePathPlusName = "/uploads/" + fileName;
                }
                else if (sExt.ToUpper() == ".DOC" || sExt.ToUpper() == ".DOCX")
                {
                    log.Info("开始上传:" + sExt);
                    //如果是word文件需要转换为pdf文件后，同时名称改变
                    if (!Directory.Exists(HttpContext.Current.Server.MapPath("~/uploaddocs")))
                    {
                        Directory.CreateDirectory(HttpContext.Current.Server.MapPath("~/uploaddocs"));
                    }
                    string strDt = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                    string path1 = Path.Combine(
                    HttpContext.Current.Server.MapPath("~/uploaddocs"),
                    strDt + fileName
                    );

                    file.SaveAs(path1);

                    //Document doc = new Document(path1);
                    //path = Path.Combine(
                    //    HttpContext.Current.Server.MapPath("~/uploads"),
                    //    strDt + ".pdf"
                    //);
                    sFactPathPDF = path;
                    //doc.Save(sFactPathPDF, Aspose.Words.SaveFormat.Pdf);
                    svrFilePathPlusName = "/uploads/" + strDt + ".PDF";

                    log.Info("保存上传:" + svrFilePathPlusName);
                }
                else
                {
                    //图片或者视频等其它文件直接存储
                    file.SaveAs(path);
                    svrFilePathPlusName = "/uploads/" + fileName;
                }
                #endregion
                #region 汇总数据字段
                try
                {
                    //Model.TrainFiles mTF = new Model.TrainFiles();
                    //mTF.TFName = fileName.Split('.')[0];
                    //mTF.KKID = Convert.ToInt32(KKID);
                    //mTF.FTID = Convert.ToInt32(FTID);
                    //mTF.TFUploadDeptID = Convert.ToInt32(TFUploadDeptID);
                    //mTF.TFFileLevel = TFFileLevel;
                    //mTF.TFFileKey = TFFileKey;
                    //mTF.TFReadTime = Convert.ToInt32(TFReadTime);
                    //mTF.TFPath = path;
                    //mTF.TFSize = file.ContentLength / 1024;
                    //mTF.TFMD5 = MD5Encrypt(fileName, "ZZIPRYFB");
                    //mTF.TFUseCount = 0;
                    //mTF.TFIsPhoto = ".jpg|.png|.jpeg|.bmp|.gif".Contains(sExt.ToLower()) ? 1 : 0;
                    //mTF.TFIsPass = 0;
                    //mTF.TFAddUserID = LoginUser.UserInfo.EID;
                    //mTF.TFAddUserName = LoginUser.UserInfo.EmpName;
                    //mTF.TFAddDateTime = DateTime.Now;
                    //mTF.TFServerPath = svrFilePathPlusName;
                    //mTF.TFIsUse = 1;

                    //log.Info("数据库存储时检查 重复！");
                    //bool blExist = new BLL.TrainFiles().Exists(mTF.TFName);
                    //if (blExist)
                    //{
                    //    //如果已经存在，说明上传重复，不处理
                    //    res.code = (int)StatusCodeEnum.NameExists;
                    //    res.msg = StatusCodeEnum.NameExists.GetEnumText();
                    //}
                    //else
                    //{
                    //    log.Info("数据库开始存储！");
                    //    new BLL.TrainFiles().Add(mTF);
                    //    res.code = (int)StatusCodeEnum.FileUploadSucess;
                    //    res.msg = StatusCodeEnum.FileUploadSucess.GetEnumText();
                    //}
                    //res.data = new cdata();
                    //res.data.src = "/uploads/" + file.FileName;
                }
                catch (Exception exc)
                {
                    log.Info("数据库开始存储错误" + exc.Message);
                    //res.code = (int)StatusCodeEnum.FileUploadSucess;
                    //res.msg = exc.Message;
                    //res.data = new cdata();
                    //res.data.src = "/uploads/" + file.FileName;
                }
                #endregion 
            }
            log.Info("文件数" + HttpContext.Current.Request.Files.Count.ToString() + "=" + fileName + "-" + path);
            return Json(res);
        }
 



    }
}
